using System;
using System.Diagnostics;
using System.IO;
using System.IO.Compression;
using System.Text;
using System.Threading;
using System.Windows.Forms;
public static class StringUtil
{
	public static string login(HttpService httpservice, string url, string data)
	{
		int num = 0;
		string result=null;
		try
		{
			//IL_02:
			result = httpservice.post_http(url, data, null);
		}
		catch (Exception ex)
		{
			string text = ex.ToString();
			if (!text.Contains("System.Net.WebException") && !text.Contains("System.IO.IOException"))
			{
				throw ex;
			}
			num++;
			if (num > 10)
			{
				MessageBox.Show("已重试10次，服务器累成狗，等一会再试咯～～～(欢迎大牛来捐服务器费^-^)");
				throw ex;
			}
			Thread.Sleep(3000);
			//goto IL_02;
		}
		return result;
	}
	public static string smethod_1(string string_0, int int_0, string string_1, string string_2, string string_3)
	{
		string text = StringUtil.subString(string_0, int_0, string_1, string_2);
		string text2 = StringUtil.subString(string_0, int_0, string_1, string_3);
		if (text.Equals(""))
		{
			return text2;
		}
		if (!text2.Equals("") && text.Length > text2.Length)
		{
			return text2;
		}
		return text;
	}
	public static string subString(string string_0, int int_0, string string_1, string string_2)
	{
		int num = string_0.IndexOf(string_1, int_0) + string_1.Length;
		if (num == string_1.Length - 1)
		{
			return "";
		}
		int num2 = string_0.IndexOf(string_2, num) - num;
		if (string_0.IndexOf(string_2, num) == -1)
		{
			num2 = string_0.Length - num;
		}
		if (num2 == 0)
		{
			return "";
		}
		return string_0.Substring(num, num2);
	}
	public static string smethod_3(byte[] byte_0)
	{
		return StringUtil.byte_to_str(byte_0, Encoding.UTF8);
	}
	public static string byte_to_str(byte[] byte_0, Encoding encoding_0)
	{
		MemoryStream stream = new MemoryStream(byte_0);
		MemoryStream memoryStream = new MemoryStream();
		GZipStream gZipStream = new GZipStream(stream, CompressionMode.Decompress);
		byte[] array = new byte[1000];
		int count;
		while ((count = gZipStream.Read(array, 0, array.Length)) > 0)
		{
			memoryStream.Write(array, 0, count);
		}
		byte_0 = memoryStream.ToArray();
		return encoding_0.GetString(byte_0);
	}
	public static void smethod_5(string string_0, string string_1, string string_2)
	{
		Process process = new Process();
		process.StartInfo.FileName = "cmd.exe";
		process.StartInfo.UseShellExecute = false;
		process.StartInfo.RedirectStandardInput = true;
		process.StartInfo.RedirectStandardOutput = true;
		process.StartInfo.RedirectStandardError = true;
		process.StartInfo.CreateNoWindow = true;
		process.Start();
		process.StandardInput.AutoFlush = true;
		process.StandardInput.WriteLine("rasdial " + string_0 + " /disconnect");
		process.StandardInput.WriteLine(string.Concat(new string[]
		{
			"rasdial ",
			string_0,
			" ",
			string_1,
			" ",
			string_2
		}));
		process.StandardInput.WriteLine("exit");
		process.StandardOutput.ReadToEnd();
		process.WaitForExit();
		process.Close();
	}
	public static void smethod_6(int int_0)
	{
		Process process = new Process();
		process.StartInfo.FileName = "cmd.exe";
		process.StartInfo.UseShellExecute = false;
		process.StartInfo.RedirectStandardInput = true;
		process.StartInfo.RedirectStandardOutput = true;
		process.StartInfo.RedirectStandardError = true;
		process.StartInfo.CreateNoWindow = true;
		process.Start();
		process.StandardInput.AutoFlush = true;
		process.StandardInput.WriteLine("shutdown -s -t " + int_0);
		process.StandardOutput.ReadToEnd();
		process.WaitForExit();
		process.Close();
	}
	public static void smethod_7(string string_0)
	{
		string text = Directory.GetCurrentDirectory() + "\\config";
		if (!Directory.Exists(text))
		{
			Directory.CreateDirectory(text);
		}
		string text2 = "\"" + text + "\\chgpcname.reg\"";
		Process process = new Process();
		process.StartInfo.FileName = "cmd.exe";
		process.StartInfo.UseShellExecute = false;
		process.StartInfo.RedirectStandardInput = true;
		process.StartInfo.RedirectStandardOutput = true;
		process.StartInfo.RedirectStandardError = true;
		process.StartInfo.CreateNoWindow = true;
		process.Start();
		process.StandardInput.AutoFlush = true;
		process.StandardInput.WriteLine("echo REGEDIT4 > " + text2);
		process.StandardInput.WriteLine("echo [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\ComputerName] >> " + text2);
		process.StandardInput.WriteLine("echo [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\ComputerName\\ComputerName] >> " + text2);
		process.StandardInput.WriteLine("echo \"ComputerName\"=\"" + string_0 + "\" >> " + text2);
		process.StandardInput.WriteLine("echo [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\ComputerName\\ActiveComputerName] >> " + text2);
		process.StandardInput.WriteLine("echo \"ComputerName\"=\"" + string_0 + "\" >> " + text2);
		process.StandardInput.WriteLine("echo [HKEY_LOCAL_MACHINE\\SYSTEM\\ControlSet002\\Control\\ComputerName\\ComputerName] >> " + text2);
		process.StandardInput.WriteLine("echo \"ComputerName\"=\"" + string_0 + "\" >> " + text2);
		process.StandardInput.WriteLine("echo [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters] >> " + text2);
		process.StandardInput.WriteLine("echo \"NV Hostname\"=\"" + string_0 + "\" >> " + text2);
		process.StandardInput.WriteLine("echo \"Hostname\"=\"" + string_0 + "\" >> " + text2);
		process.StandardInput.WriteLine("echo [HKEY_USERS\\S-1-5-18\\Software\\Microsoft\\Windows\\ShellNoRoam] >> " + text2);
		process.StandardInput.WriteLine("echo @=\"" + string_0 + "\" >> " + text2);
		process.StandardInput.WriteLine("echo [HKEY_LOCAL_MACHINE\\SYSTEM\\ControlSet001\\Control\\ComputerName\\ActiveComputerName] >> " + text2);
		process.StandardInput.WriteLine("echo \"ComputerName\"=\"" + string_0 + "\" >> " + text2);
		process.StandardInput.WriteLine("echo echo [HKEY_LOCAL_MACHINE\\SYSTEM\\ControlSet001\\Services\\Tcpip\\Parameters] >> " + text2);
		process.StandardInput.WriteLine("echo \"NV Hostname\"=\"" + string_0 + "\" >> " + text2);
		process.StandardInput.WriteLine("echo \"Hostname\"=\"" + string_0 + "\" >> " + text2);
		process.StandardInput.WriteLine("echo [HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon] >> " + text2);
		process.StandardInput.WriteLine("echo \"DefaultDomainName\"=\"" + string_0 + "\" >> " + text2);
		process.StandardInput.WriteLine("echo \"AltDefaultDomainName\"=\"" + string_0 + "\" >> " + text2);
		process.StandardInput.WriteLine("regedit /s " + text2);
		process.StandardInput.WriteLine("exit");
		process.StandardOutput.ReadToEnd();
		process.WaitForExit();
		process.Close();
	}
	public static void smethod_8()
	{
		if (Process.GetProcessesByName(Process.GetCurrentProcess().ProcessName).Length > 1)
		{
			MessageBox.Show("程序已经运行！", "消息", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
			Environment.Exit(Environment.ExitCode);
		}
	}
}
